Graphics importer components, introduced in QuickTime 2.5, provide a standard method for applications to open and display still images contained within graphics documents. Graphics importer components allow you to work with any type of image data, regardless of the file format or compression used in the document. You specify the document that contains the image, and the destination rectangle the image should be drawn into, and QuickTime handles the rest. More complex interactions are also supported.
The following example code ( Listing 16-1 ) shows the basic functions you use to draw an image file.
Listing 1 The basic functions used to draw an image file
void drawFile(const FSSpec *fss, const Rect *boundsRect)
{
GraphicsImportComponent gi;
GetGraphicsImporterForFile(fss, &gi);
GraphicsImportSetBoundsRect(gi, boundsRect);
GraphicsImportDraw(gi);
CloseComponent(gi);
}
The same code can be used to display any image, regardless of the file format.
| Previous | Chapter Contents | Chapter Top | Next |